package com.wxg.config.kafka;

import com.wxg.domain.MqConstant;
import org.springframework.context.annotation.Condition;
import org.springframework.context.annotation.ConditionContext;
import org.springframework.core.type.AnnotatedTypeMetadata;
import org.springframework.stereotype.Component;

/**
 * @author void
 * @date 2019/12/30 14:22
 * @desc
 */
@Component
public class KafkaCondition implements Condition {

    @Override
    public boolean matches(ConditionContext conditionContext, AnnotatedTypeMetadata annotatedTypeMetadata) {
        if(conditionContext.getEnvironment().getProperty("mq.type").matches(MqConstant.MqType.kafka.name())){
            return true;
        }
        return false;
    }
}
